<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>实时动态</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<style type="text/css">
		*{
			margin:0;
			padding:0;
			border:0;
			outline:0;
			list-style:none;
			color: #333;
		}
		body{
			background: url(${ctxStatic}/swjk64.jpg) no-repeat;
			background-size: 100% 100%;
		}
		.top_box{
			float: left;
			width: 99%;
		}
		.title{
			float: left;
			width: 50%;
			text-align: left;
			height: 40px;
			line-height: 40px;
			color: #333333;
			font-size: 18px;
			font-weight: normal;
			margin: 10px 0 0 0;
			margin-left: 2%;
		}
		.top_btn{
			float: right;
			padding: 0 10px;
			height: 30px;
			line-height: 30px;
			text-align: center;
			color: #FFFFFF;
			background: #0099cc;
			font-size: 15px;
			margin-top: 15px;
			border-radius: 4px;
		}
		.top_btn:hover{
			background: #0186b3;
		}
		.content{
			float: left;
			width: 99%;
			height: 98%;

		}


		/*实时动态*/
		.chart_top{
			float: left;
			width: 100%;
			height: 30px;
		}
		.chart_top_title{
			float: left;
			width: 120px;
			padding-left: 30px;
			height: 30px;
			text-align: left;
			line-height: 30px;
			color: #fff;
			font-size: 16px;
			margin-left: 2%;
			font-weight: 600;
			background: url(${ctxStatic}/swjk71.png) no-repeat;
			background-size: 18px 18px;
			background-position: left center;
		}
		.chart_top_center{
			float: left;
			width: 140px;
			height: 30px;
			text-align: left;
			line-height: 30px;
			color: #fff;
			font-size: 14px;
			margin-left: 20px;
		}
		.full_screen{
			float: right;
			text-align: center;
			height: 30px;
			line-height: 30px;
			font-size: 14px;
			color: #fff;
			margin-right: 2%;
		}
		.chart_left{
			float: left;
			width: 4%;
			height: 92%;
			margin-left: 2%;
			margin-top: 1%;
		}
		.chart_left li{
			float: left;
			width: 80%;
			padding-right: 20%;
			height: 5%;
			font-size: 14px;
			color: #fff;
			text-align: right;
		}
		.chart_right{
			margin-top: 1%;
			float: left;
			width: 94%;
			height: 92%;
		}
		.chart_right_box1{
			float: left;
			width: 100%;
			height: 26.5%;
			background: url(${ctxStatic}/swjk65.png) no-repeat;
			background-size: 115% 4px;
			background-position: center 94%;
			position: relative;
		}

		.chart_right_box2{
			float: left;
			width: 100%;
			height: 12.2%;
			background: url(${ctxStatic}/swjk66.png) no-repeat;
			background-size: 115% 4px;
			background-position: center bottom;
			position: relative;
		}

		.chart_right_box3{
			float: left;
			width: 100%;
			height: 5%;
			background: url(${ctxStatic}/swjk67.png) no-repeat;
			background-size: 115% 4px;
			background-position: center bottom;
			position: relative;
		}
		.chart_right_box4{
			float: left;
			width: 100%;
			height: 58%;
			position: relative;
		}
		.chart_detail{
			width: 12px;
			height: 12px;
			border-radius: 6px;
			position: absolute;
			cursor: pointer;
		}
		.chart_detail.red{
			background: url(${ctxStatic}/swjk68.png) no-repeat;
			background-size: 100% 100%;
			background-position: center center;
		}
		.chart_detail.blue{
			background: url(${ctxStatic}/swjk70.png) no-repeat;
			background-size: 100% 100%;
			background-position: center center;
		}
		.chart_detail.green{
			background: url(${ctxStatic}/swjk69.png) no-repeat;
			background-size: 100% 100%;
			background-position: center center;
		}
		.chart_hover{
			display: none;
			position: absolute;
			top: 0px;
			left: 20px;
			width: 200px;
			padding: 0 10px;
			background: #fff;
			box-shadow: 3px 3px 3px #e5e5e5;
			border: 1px solid #E9E9E9;
			z-index: 999;
		}
		.chart_right_box4 .chart_detail .chart_hover{
			top: -200px;
		}
		.chart_hover li{
			width: 160px;
			line-height: 30px;
			color: #333333;
			font-size: 14px;
			text-align: left;
		}
		.chart_hover li:nth-child(1){
			color: #16a1c7;
			font-size: 20px;
		}
		.chart_detail:hover .chart_hover{
			display: block;
		}
		/*实时动态*/
	</style>
</head>
<body>

<!-- 加载中 -->
<input type='hidden' id="level_type" value="company" /><input type='hidden' id="level_name" value="九台荣祥供热有限公司" />
<div class="content">
	<div class="chart_top">
		<p class="chart_top_title">
			实时动态
		</p>
		<p class="chart_top_center" id="max">
			最高温度：-°C
		</p>
		<p class="chart_top_center" id="min">
			最低温度：-°C
		</p>
		<p class="chart_top_center" id="avg">
			平均温度：-°C
		</p>
		<p class="chart_top_center" id="total">
			接收计数：0条
		</p>
		<p class="chart_top_center" id="">
			层级计数：671条
		</p>
	</div>
	<ul class="chart_left"></ul>
	<div class="chart_right">
		<div class="chart_right_box1"></div>
		<div class="chart_right_box2"></div>
		<div class="chart_right_box3"></div>
		<div class="chart_right_box4"></div>
	</div>
</div>
<!--提示-->
<div class="remind_box">
	<span class="remind_box_title"></span>
</div>
<!--提示-->
<img src="${ctxStatic}/swjk68.png" style="display: none;"><img src="${ctxStatic}/swjk69.png" style="display: none;"><img src="${ctxStatic}/swjk70.png" style="display: none;">
<script src="${ctxStatic}/jquery/jquery-1.12.4.min.js"></script>

<!--  页面加载完成之后隐藏加载中 -->
<script type="text/javascript">
	function getCookie(name) {
		var cookieValue = null;
		if (document.cookie && document.cookie != '') {
			var cookies = document.cookie.split(';');
			for (var i = 0; i < cookies.length; i++) {
				var cookie = jQuery.trim(cookies[i]);
				// Does this cookie string begin with the name we want?
				if (cookie.substring(0, name.length + 1) == (name + '=')) {
					cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
					break;
				}
			}
		}
		return cookieValue;
	}
	$.ajaxSetup({
		beforeSend: function (xhr, settings) {
			xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
		}
	});
	//图数据
	function push_data(userlist) {
		userlist = [
			{ "id": 21, "title": "35°C" },
			{ "id": 20, "title": "33°C" },
			{ "id": 19, "title": "31°C" },
			{ "id": 18, "title": "29°C" },
			{ "id": 17, "title": "27°C" },
			{ "id": 16, "title": "25°C" },
			{ "id": 15, "title": "23°C" },
			{ "id": 14, "title": "21°C" },
			{ "id": 13, "title": "19°C" },
			{ "id": 12, "title": "17°C" },
			{ "id": 11, "title": "15°C" },
			{ "id": 10, "title": "13°C" },
			{ "id": 9, "title": "11°C" },
			{ "id": 8, "title": "9°C" },
			{ "id": 7, "title": "7°C" },
			{ "id": 6, "title": "5°C" },
			{ "id": 5, "title": "3°C" },
			{ "id": 4, "title": "1°C" },
			{ "id": 3, "title": "-1°C" },
			{ "id": 2, "title": "-3°C" },
			{ "id": 1, "title": "-5°C" }
		];
		for (var i = 0, n; n = userlist[i]; i++) {
			var li = document.createElement("li");
			li.id = "d" + i;
			li.innerHTML = n.title;
			document.getElementsByClassName("chart_left")[0].appendChild(li);
		}
	}
	push_data();
	gwlist = [];
	lasttime = '';
	totalnum = 0;
	maxtemp = 0;
	mintemp = 100;
	avgtemp = 0;
	countnum = 0;
	//条目总数据
	var table_rows = 0;
	var q = 0;
	var chart_right = document.getElementsByClassName("chart_right")[0];
	var boxw = chart_right.clientWidth / 1.3;
	if (q >= 0) {
		url = '/temp/reallastest/';
		level_type = $("#level_type").val();
		level_name = $("#level_name").val();
		data = { lasttime: lasttime, need: 1000, level_type: level_type, level_name: level_name };
		$.ajax({ type: 'POST', url: url, data: data, success: function (result) {
				q = 0;
				gwlist = [];
				T = result['data'];
				for (i in T) {
					totalnum += 1;
					gwlist.push({
						id: totalnum,
						wendu: T[i]['temp'],
						username: T[i]['host'],
						cwid: T[i]['heatid'],
						address: T[i]['addr'],
						mianji: T[i]['square'],
						register_time: T[i]['regdate'],
						xinghao: T[i]['htype'],
						dianxing: T[i]['classic'],
						fa_id: T[i]['valveid'],
						faxinghao: T[i]['vtype'],
						fasuo: T[i]['vlock'],
						shijian: T[i]['temptime']
					});
				}
				table_rows = T.length;
				lasttime = result['lasttime'];
				jj = 0;
				animate_sel(lasttime, 1000, level_type, level_name, jj, table_rows);
			}, error: function (result) {
			} });
	}
	function animate_sel(a, b, c, d, jj, table_rows) {
		//	clearInterval(q_sel);
		var q_sel = setInterval(function () {
			var n = gwlist[q];
			var sdsds = gwlist[q];
			if (!sdsds) {
				clearInterval(q_sel);
			}
			else {
				if (n.wendu > maxtemp && n.wendu <= 35) {
					maxtemp = n.wendu;
					$("#max").text("最高温度：" + parseFloat(maxtemp).toFixed(1) + "°C");
				}
				if (n.wendu < mintemp && n.wendu >= -5) {
					mintemp = n.wendu;
					$("#min").text("最低温度：" + parseFloat(mintemp).toFixed(1) + "°C");
				}
				avgtemp = (avgtemp * countnum + parseFloat(n.wendu)) / (countnum + 1);
				$("#avg").text("平均温度：" + parseFloat(avgtemp).toFixed(1) + "°C");
				countnum += 1;
				$("#total").text("接收计数：" + countnum + "条");
				//删除数据
				if (countnum > 2000) {
					rrr = countnum - 2000;
					$(".sb" + rrr + "").remove();
				}
				if (gwlist[q].wendu >= 26 && gwlist[q].wendu <= 35) {
					function RndNum(n) {
						var rnd = "";
						for (var i = 0; i < n; i++) {
							rnd += parseFloat(Math.random() * 99);
							return rnd;
						}
					}
					var div = document.createElement("div");
					div.className = "chart_detail red sb" + countnum + "";
					div.id = "" + n.cwid + "";
					div.style.left = RndNum(2) + "%";
					//判断温度给divtop
					if (gwlist[q].wendu >= 26 && gwlist[q].wendu < 27) {
						div.style.top = parseFloat(Math.random() * (85 - 81 + 1) + 81) + "%";
					}
					else if (gwlist[q].wendu >= 27 && gwlist[q].wendu < 28) {
						div.style.top = parseFloat(Math.random() * (77 - 72 + 1) + 72) + "%";
					}
					else if (gwlist[q].wendu >= 28 && gwlist[q].wendu < 29) {
						div.style.top = parseFloat(Math.random() * (67 - 62 + 1) + 62) + "%";
					}
					else if (gwlist[q].wendu >= 29 && gwlist[q].wendu < 30) {
						div.style.top = parseFloat(Math.random() * (58.5 - 53.5 + 1) + 53.5) + "%";
					}
					else if (gwlist[q].wendu >= 30 && gwlist[q].wendu < 30.5) {
						div.style.top = parseFloat(Math.random() * (49 - 44 + 1) + 44) + "%";
					}
					else if (gwlist[q].wendu >= 30.5 && gwlist[q].wendu < 31) {
						div.style.top = parseFloat(Math.random() * (45 - 40 + 1) + 40) + "%";
					}
					else if (gwlist[q].wendu >= 31 && gwlist[q].wendu < 32) {
						div.style.top = parseFloat(Math.random() * (40 - 35 + 1) + 35) + "%";
					}
					else if (gwlist[q].wendu >= 32 && gwlist[q].wendu < 33) {
						div.style.top = parseFloat(Math.random() * (30 - 25 + 1) + 25) + "%";
					}
					else if (gwlist[q].wendu >= 33 && gwlist[q].wendu < 34) {
						div.style.top = parseFloat(Math.random() * (21 - 16 + 1) + 16) + "%";
					}
					else if (gwlist[q].wendu >= 34 && gwlist[q].wendu < 35) {
						div.style.top = parseFloat(Math.random() * (12 - 7 + 1) + 7) + "%";
					}
					else if (gwlist[q].wendu == 35) {
						div.style.top = parseFloat(Math.random() * (2 - 1 + 1) + 1) + "%";
					}
					else {
						div.style.display = "none";
						var ul = document.createElement("ul");
						ul.className = "chart_hover";
						$(ul).attr('abc', n.cwid);
						//+ "<li>"+ "阀ID：" + n.fa_id + "</li>" + "<li>" + "阀型号：" + n.faxinghao + "</li>" + "<li>" + "阀锁：" + n.fasuo + "</li>"
						ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
						div.appendChild(ul);
						document.body.appendChild(div);
						$(div).stop().animate({ opacity: "0" }, 1000).animate({ opacity: "1" }, 1000); //闪烁动画
					}
					var ul = document.createElement("ul");
					ul.className = "chart_hover";
					$(ul).attr('abc', n.cwid);
					ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
					div.appendChild(ul);
					var img = document.createElement("img");
					img.style.width = "12px";
					img.style.height = "12px";
					img.style.display = "block";
					img.src = "${ctxStatic}/swjk68.png";
					div.appendChild(img);
					//判断测温ID是否存在
					if (document.getElementById(n.cwid)) {
						$("#" + n.cwid).remove();
						countnum - 1;
					}
					document.getElementsByClassName("chart_right_box1")[0].appendChild(div);
					//判断如果div过度靠右鼠标经过内容将显示在左侧
					if (div.offsetLeft > boxw) {
						ul.style.left = "-230px";
					}
					$(div).stop().animate({ opacity: "0" }, 1000).animate({ opacity: "1" }, 1000); //闪烁动画
				}
				else if (gwlist[q].wendu >= 20 && gwlist[q].wendu < 26) {
					function RndNum(n) {
						var rnd = "";
						for (var i = 0; i < n; i++) {
							rnd += parseFloat(Math.random() * 99);
							return rnd;
						}
					}
					var div = document.createElement("div");
					div.className = "chart_detail red sb" + countnum + "";
					div.id = "" + n.cwid + "";
					div.style.left = RndNum(2) + "%";
					//判断温度给divtop
					if (gwlist[q].wendu >= 20 && gwlist[q].wendu < 20.5) {
						div.style.top = parseFloat(Math.random() * (85 - 70 + 1) + 79) + "%";
					}
					else if (gwlist[q].wendu >= 20.5 && gwlist[q].wendu < 21) {
						div.style.top = parseFloat(Math.random() * (80 - 70 + 1) + 75) + "%";
					}
					else if (gwlist[q].wendu >= 21 && gwlist[q].wendu < 21.5) {
						div.style.top = parseFloat(Math.random() * (75 - 69 + 1) + 69) + "%";
					}
					else if (gwlist[q].wendu >= 21.5 && gwlist[q].wendu < 22) {
						div.style.top = parseFloat(Math.random() * (70 - 65 + 1) + 60) + "%";
					}
					else if (gwlist[q].wendu >= 22 && gwlist[q].wendu < 22.5) {
						div.style.top = parseFloat(Math.random() * (55 - 60 + 1) + 57) + "%";
					}
					else if (gwlist[q].wendu >= 22.5 && gwlist[q].wendu < 23) {
						div.style.top = parseFloat(Math.random() * (48 - 55 + 1) + 49) + "%";
					}
					else if (gwlist[q].wendu >= 23 && gwlist[q].wendu < 23.5) {
						div.style.top = parseFloat(Math.random() * (42 - 50 + 1) + 39) + "%";
					}
					else if (gwlist[q].wendu >= 23.5 && gwlist[q].wendu < 24) {
						div.style.top = parseFloat(Math.random() * (32 - 35 + 1) + 29) + "%";
					}
					else if (gwlist[q].wendu >= 24 && gwlist[q].wendu < 24.5) {
						div.style.top = parseFloat(Math.random() * (22 - 25 + 1) + 19) + "%";
					}
					else if (gwlist[q].wendu >= 24.5 && gwlist[q].wendu < 25) {
						div.style.top = parseFloat(Math.random() * (12 - 27 + 1) + 9) + "%";
					}
					else if (gwlist[q].wendu >= 25 && gwlist[q].wendu < 26) {
						div.style.top = parseFloat(Math.random() * (1 - 20 + 1) + 3) + "%";
					}
					else {
						div.style.display = "none";
						var ul = document.createElement("ul");
						ul.className = "chart_hover";
						$(ul).attr('abc', n.cwid);
						ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
						div.appendChild(ul);
						document.body.appendChild(div);
						$(div).stop().animate({ opacity: "0" }, 1000).animate({ opacity: "1" }, 1000); //闪烁动画
					}
					var ul = document.createElement("ul");
					ul.className = "chart_hover";
					$(ul).attr('abc', n.cwid);
					ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
					div.appendChild(ul);
					var img = document.createElement("img");
					img.style.width = "12px";
					img.style.height = "12px";
					img.style.display = "block";
					img.src = "${ctxStatic}/dian.png";
					div.appendChild(img);
					//判断测温ID是否存在
					if (document.getElementById(n.cwid)) {
						$("#" + n.cwid).remove();
						countnum - 1;
					}
					document.getElementsByClassName("chart_right_box2")[0].appendChild(div);
					//判断如果div过度靠右鼠标经过内容将显示在左侧
					if (div.offsetLeft > boxw) {
						ul.style.left = "-230px";
					}
					$(div).stop().animate({ opacity: "0" }, 1000).animate({ opacity: "1" }, 1000); //闪烁动画
				}
				else if (gwlist[q].wendu >= 18 && gwlist[q].wendu < 20) {
					function RndNum(n) {
						var rnd = "";
						for (var i = 0; i < n; i++) {
							rnd += parseFloat(Math.random() * 99);
							return rnd;
						}
					}
					var div = document.createElement("div");
					div.className = "chart_detail green sb" + countnum + "";
					div.id = "" + n.cwid + "";
					div.style.left = RndNum(2) + "%";
					//判断温度给divtop
					if (gwlist[q].wendu >= 19.5 && gwlist[q].wendu < 20) {
						div.style.top = parseFloat(Math.random() * (40 - 45 + 1) + 2) + "%";
					}
					else if (gwlist[q].wendu >= 19 && gwlist[q].wendu < 19.5) {
						div.style.top = parseFloat(Math.random() * (30 - 35 + 1) + 10) + "%";
					}
					else if (gwlist[q].wendu >= 18.5 && gwlist[q].wendu < 19) {
						div.style.top = parseFloat(Math.random() * (50 - 5 + 1) + 20) + "%";
					}
					else if (gwlist[q].wendu >= 18 && gwlist[q].wendu < 18.5) {
						div.style.top = parseFloat(Math.random() * (45 - 10 + 10) + 40) + "%";
					}
					else {
						div.style.display = "none";
						var ul = document.createElement("ul");
						ul.className = "chart_hover";
						$(ul).attr('abc', n.cwid);
						ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
						div.appendChild(ul);
						document.body.appendChild(div);
						$(div).stop().animate({ opacity: "0" }, 1000).animate({ opacity: "1" }, 1000); //闪烁动画
					}
					var ul = document.createElement("ul");
					ul.className = "chart_hover";
					$(ul).attr('abc', n.cwid);
					ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
					div.appendChild(ul);
					var img = document.createElement("img");
					img.style.width = "12px";
					img.style.height = "12px";
					img.style.display = "block";
					img.src = "${ctxStatic}/swjk69.png";
					div.appendChild(img);
					//判断测温ID是否存在
					if (document.getElementById(n.cwid)) {
						$("#" + n.cwid).remove();
						countnum - 1;
					}
					document.getElementsByClassName("chart_right_box3")[0].appendChild(div);
					//判断如果div过度靠右鼠标经过内容将显示在左侧
					if (div.offsetLeft > boxw) {
						ul.style.left = "-230px";
					}
					$(div).stop().animate({ opacity: "0" }, 1000).animate({ opacity: "1" }, 1000); //闪烁动画
				}
				else if (gwlist[q].wendu >= -5 && gwlist[q].wendu < 18) {
					function RndNum(n) {
						var rnd = "";
						for (var i = 0; i < n; i++) {
							rnd += parseFloat(Math.random() * 99);
							return rnd;
						}
					}
					var div = document.createElement("div");
					div.className = "chart_detail blue sb" + countnum + "";
					div.id = "" + n.cwid + "";
					div.style.left = RndNum(2) + "%";
					//判断温度给divtop
					if (gwlist[q].wendu >= -5 && gwlist[q].wendu < -4) {
						div.style.top = parseFloat(Math.random() * (98 - 96 + 1) + 96) + "%";
					}
					else if (gwlist[q].wendu >= -4 && gwlist[q].wendu < -3) {
						div.style.top = parseFloat(Math.random() * (93.5 - 91.5 + 1) + 91.5) + "%";
					}
					else if (gwlist[q].wendu >= -3 && gwlist[q].wendu < -2) {
						div.style.top = parseFloat(Math.random() * (90 - 89 + 1) + 89) + "%";
					}
					else if (gwlist[q].wendu >= -2 && gwlist[q].wendu < -1) {
						div.style.top = parseFloat(Math.random() * (86 - 84 + 1) + 84) + "%";
					}
					else if (gwlist[q].wendu >= -1 && gwlist[q].wendu < 0) {
						div.style.top = parseFloat(Math.random() * (81 - 79 + 1) + 79) + "%";
					}
					else if (gwlist[q].wendu >= 0 && gwlist[q].wendu < 1) {
						div.style.top = parseFloat(Math.random() * (76 - 75 + 1) + 75) + "%";
					}
					else if (gwlist[q].wendu >= 1 && gwlist[q].wendu < 2) {
						div.style.top = parseFloat(Math.random() * (73 - 71 + 1) + 71) + "%";
					}
					else if (gwlist[q].wendu >= 2 && gwlist[q].wendu < 3) {
						div.style.top = parseFloat(Math.random() * (67 - 65 + 1) + 65) + "%";
					}
					else if (gwlist[q].wendu >= 3 && gwlist[q].wendu < 4) {
						div.style.top = parseFloat(Math.random() * (64 - 62 + 1) + 62) + "%";
					}
					else if (gwlist[q].wendu >= 4 && gwlist[q].wendu < 5) {
						div.style.top = parseFloat(Math.random() * (59 - 57 + 1) + 57) + "%";
					}
					else if (gwlist[q].wendu >= 5 && gwlist[q].wendu < 6) {
						div.style.top = parseFloat(Math.random() * (56 - 54 + 1) + 54) + "%";
					}
					else if (gwlist[q].wendu >= 6 && gwlist[q].wendu < 7) {
						div.style.top = parseFloat(Math.random() * (51 - 49 + 1) + 49) + "%";
					}
					else if (gwlist[q].wendu >= 7 && gwlist[q].wendu < 8) {
						div.style.top = parseFloat(Math.random() * (44 - 44 + 1) + 43) + "%";
					}
					else if (gwlist[q].wendu >= 8 && gwlist[q].wendu < 9) {
						div.style.top = parseFloat(Math.random() * (42 - 40 + 1) + 40) + "%";
					}
					else if (gwlist[q].wendu >= 9 && gwlist[q].wendu < 10) {
						div.style.top = parseFloat(Math.random() * (38 - 36 + 1) + 36) + "%";
					}
					else if (gwlist[q].wendu >= 10 && gwlist[q].wendu < 11) {
						div.style.top = parseFloat(Math.random() * (34 - 32 + 1) + 32) + "%";
					}
					else if (gwlist[q].wendu >= 11 && gwlist[q].wendu < 12) {
						div.style.top = parseFloat(Math.random() * (30 - 28 + 1) + 28) + "%";
					}
					else if (gwlist[q].wendu >= 12 && gwlist[q].wendu < 13) {
						div.style.top = parseFloat(Math.random() * (25 - 21 + 1) + 21) + "%";
					}
					else if (gwlist[q].wendu >= 13 && gwlist[q].wendu < 14) {
						div.style.top = parseFloat(Math.random() * (22 - 20 + 1) + 20) + "%";
					}
					else if (gwlist[q].wendu >= 14 && gwlist[q].wendu < 15) {
						div.style.top = parseFloat(Math.random() * (17 - 14 + 1) + 14) + "%";
					}
					else if (gwlist[q].wendu >= 15 && gwlist[q].wendu < 16) {
						div.style.top = parseFloat(Math.random() * (10 - 12 + 1) + 12) + "%";
					}
					else if (gwlist[q].wendu >= 16 && gwlist[q].wendu < 17) {
						div.style.top = parseFloat(Math.random() * (9 - 6 + 1) + 6) + "%";
					}
					else if (gwlist[q].wendu >= 17 && gwlist[q].wendu < 18) {
						div.style.top = parseFloat(Math.random() * (2 - 1 + 1) + 1) + "%";
					}
					else {
						div.style.display = "none";
						var ul = document.createElement("ul");
						ul.className = "chart_hover";
						$(ul).attr('abc', n.cwid);
						ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
						div.appendChild(ul);
						document.body.appendChild(div);
						$(div).stop().animate({ opacity: "0" }, 1000).animate({ opacity: "1" }, 1000); //闪烁动画
					}
					var ul = document.createElement("ul");
					ul.className = "chart_hover";
					$(ul).attr('abc', n.cwid);
					ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
					div.appendChild(ul);
					var img = document.createElement("img");
					img.style.width = "12px";
					img.style.height = "12px";
					img.style.display = "block";
					img.src = "${ctxStatic}/swjk70.png";
					div.appendChild(img);
					//判断测温ID是否存在
					if (document.getElementById(n.cwid)) {
						$("#" + n.cwid).remove();
						countnum - 1;
					}
					document.getElementsByClassName("chart_right_box4")[0].appendChild(div);
					//判断如果div过度靠右鼠标经过内容将显示在左侧
					if (div.offsetLeft > boxw) {
						ul.style.left = "-230px";
					}
					$(div).stop().animate({ opacity: "0" }, 1000).animate({ opacity: "1" }, 1000); //闪烁动画
				}
				else if (gwlist[q].wendu > 35 || gwlist[q].wendu < -5) {
					function RndNum(n) {
						var rnd = "";
						for (var i = 0; i < n; i++) {
							rnd += parseFloat(Math.random() * 99);
							return rnd;
						}
					}
					var div = document.createElement("div");
					div.className = "chart_detail blue sb" + countnum + "";
					div.id = "" + n.cwid + "";
					div.style.left = RndNum(2) + "%";
					//判断温度给divtop
					var ul = document.createElement("ul");
					ul.className = "chart_hover";
					$(ul).attr('abc', n.cwid);
					ul.innerHTML += "<li>" + n.wendu + "°C" + "</li>" + "<li>" + "用户名：" + n.username + "</li>" + "<li>" + "测温ID：" + n.cwid + "</li>" + "<li>" + "地址：" + n.address + "</li>" + "<li>" + "面积：" + n.mianji + "</li>" + "<li>" + "注册时间：" + n.register_time + "</li>" + "<li>" + "测温型号：" + n.xinghao + "</li>" + "<li>" + "典型用户：" + n.dianxing + "</li>" + "<li>" + "上数时间：" + n.shijian + "</li>";
					div.appendChild(ul);
					var img = document.createElement("img");
					img.style.width = "12px";
					img.style.height = "12px";
					img.style.display = "block";
					img.src = "${ctxStatic}/swjk70.png";
					div.appendChild(img);
					//判断测温ID是否存在
					if (document.getElementById(n.cwid)) {
						$("#" + n.cwid).remove();
						countnum - 1;
					}
					document.getElementsByClassName("chart_right_box4")[0].appendChild(div);
					//判断如果div过度靠右鼠标经过内容将显示在左侧
					if (div.offsetLeft > boxw) {
						ul.style.left = "-230px";
					}
					//$(div).stop().animate({opacity:"0"},1000).animate({opacity:"1"},1000);//闪烁动画
					$(div).hide();
				}
				// }
				//点击上数点跳页到平均温度页
				$('.chart_detail').click(function () {
					var theId = $(this).find('ul').attr('abc');
					window.location.href = "/temp/real/?searchuser=" + theId;
				});
			}
			q += 1;
			//当走完1000个再取在走
			if (table_rows == q) {
				clearInterval(q_sel);
				data = { lasttime: a, need: b, level_type: c, level_name: d };
				$.ajax({ type: 'POST', url: url, data: data, success: function (result) {
						q = 0;
						gwlist = [];
						T = result['data'];
						for (i in T) {
							totalnum++;
							gwlist.push({
								id: totalnum,
								wendu: T[i]['temp'],
								username: T[i]['host'],
								cwid: T[i]['heatid'],
								address: T[i]['addr'],
								mianji: T[i]['square'],
								register_time: T[i]['regdate'],
								xinghao: T[i]['htype'],
								dianxing: T[i]['classic'],
								fa_id: T[i]['valveid'],
								faxinghao: T[i]['vtype'],
								fasuo: T[i]['vlock'],
								shijian: T[i]['temptime']
							});
						}
						table_rows = T.length;
						jhb = result['lasttime'];
						animate_sel(jhb, b, c, d, jj, table_rows);
					}, error: function (result) {
					} });
			}
		}, 30);
		//点击上数点跳页到平均温度页
		$('.chart_detail').click(function () {
			var theId = $(this).find('ul').attr('abc');
			window.location.href = "/temp/real/?searchuser=" + theId;
		});
	}
</script>
</body>
</html>